package com.shizi.influx.db.service;

import com.influxdb.client.QueryApi;
import com.influxdb.client.WriteApiBlocking;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ShiZi
 * @date 2024/8/20
 * <p>linkgap</p>
 */
@Service
public class InfluxDbService {
    @Autowired
    private WriteApiBlocking writeApiBlocking;
    @Autowired
    private QueryApi queryApi;

    public boolean insert() {
        Point point = new Point("temp");
        point.time(System.currentTimeMillis(), WritePrecision.MS);
        point.addField("value", 10.0);
        writeApiBlocking.writePoint(point);
        return true;
    }

}
